#region usings

using System;
using System.Drawing;
using System.Collections;
using System.Diagnostics;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;



using CStock;
using CGraph;
using CUtil;

#endregion

namespace CapitalReSources
{
	/// <summary>
	/// Summary description for Options.
	/// </summary>
	public class FormOptions : System.Windows.Forms.Form
	{
		private string path ;
		private DataGrid dataGrid;
		private IDataGridClass dataGridClass;
		private IGrid gridDetails;
		private IProgramContext programContext;

		private System.Windows.Forms.TabControl tabControl1;
		private EForms.EButton buttonSave;
		
		private EForms.EButton buttonDefault;
		
		private EForms.EButton buttonSimpleDefault;
		private System.Windows.Forms.TabPage tabPageTree;
		private System.Windows.Forms.TabPage tabPageList;
		private System.Windows.Forms.TabPage tabPageGrid;
		private EForms.EButton buttonSaveGrid;
		private EForms.EButton buttonSimpleDefaultGrid;
		private EForms.EButton buttonDefaultGrid;
		
		
		private System.Windows.Forms.MainMenu mainMenu1;
		private System.Windows.Forms.TabPage tabPageStockGraph;
		
		private System.Windows.Forms.TabPage tabPageGeneral;
		private System.Windows.Forms.Label labelGraphDateEnd;
		private System.Windows.Forms.Label labelGraphDateStart;
		private EForms.EButton buttonDefaultDates;
		private EForms.EButton buttonOK;
		private System.Windows.Forms.DateTimePicker datePickerChartMin;
        private System.Windows.Forms.DateTimePicker datePickerCharMax;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.DateTimePicker datePickerTradeMin;
		private System.Windows.Forms.DateTimePicker datePickerTradeMax;
		private System.Windows.Forms.DateTimePicker dateTimePickerSimulationMax;
		private System.Windows.Forms.DateTimePicker dateTimePickerSimulationMin;
		private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label6;
		private EForms.EButton buttonCancel;
		private System.Windows.Forms.TabPage tabPageTrade;
		private System.Windows.Forms.CheckBox checkBoxShortSell;
		private System.Windows.Forms.CheckBox checkBoxStopLoss;
		private System.Windows.Forms.TextBox textBoxStopLoss;
		private System.Windows.Forms.Label labelStopLoss;
		private System.Windows.Forms.TabPage tabPageUpdateQuotes;
		private System.Windows.Forms.Label labelDateEnd;
		private System.Windows.Forms.DateTimePicker datePickerUpdateEnd;
		private EForms.EButton buttonUpdateQuotes;
		private EForms.EButton buttonDownloadUpdateFile;
		
		private EForms.EButton buttonExtractZipFile;
		private EForms.EButton buttonUpdate;

		private QuoteWriter quoteWriter;
		private System.Windows.Forms.CheckBox checkBoxStopWin;
		private System.Windows.Forms.Label labelStopWin;
		private System.Windows.Forms.TextBox textBoxStopWin;
		private System.Windows.Forms.CheckBox checkBoxTrade10000;
		private System.Windows.Forms.CheckBox checkBoxShortSellOtherSystem;
		private System.Windows.Forms.TabPage tabPagetabPageIntraday;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.DateTimePicker dateTimePickerIntraday;
		private System.Windows.Forms.Label label9;
		private System.Windows.Forms.Label label10;
		private System.Windows.Forms.TextBox textBoxIntradaySaveInterval;
		private System.Windows.Forms.CheckBox checkBoxIntradayTrade;
		private EForms.EButton buttonDateSave;
		private EForms.EButton buttonDateDefault;
		private EForms.EButton buttonSaveIntraday;
		private EForms.EButton buttonDefaultIntraday;
		private System.Windows.Forms.CheckBox checkBoxFuturesTrade;
		private System.Windows.Forms.CheckBox checkBoxDynamicLimit;
		private System.Windows.Forms.Label labelDynamicLimit;
        private System.Windows.Forms.TextBox textBoxDynamicLimit;
        private TabPage tabPagePath;
        private TextBox textBoxPath;
        private Label label12;
        private TextBox textBoxID;
        private Label label14;
        private TextBox textBoxDataDirectory;
        private Label label13;
        private CheckBox checkBoxWebUpdateOnlyLast200;
        private ComboBox comboBoxProgramMode;
        private Label label15;
        private CheckBox checkBoxTradeOneShare;
        private DateTimePicker datePickerUpdateStart;
        private Label label16;
        private GroupBox gbxChart;
        private GroupBox gbxSimulation;
        private GroupBox gbxUserTradings;
        private Button buttonBrowseDirectory;
        private Button buttonBrowsePath;
        private IContainer components;
		/// <summary>
		/// 
		/// </summary>
		public FormOptions()
		{
			InitializeComponent();
			
		}
		/// <summary>
		/// 
		/// </summary>
		/// <param name="myPath"></param>
		/// <param name="myGridDataView"></param>
		/// <param name="myDataGridClass"></param>
		public FormOptions(string myPath,IGrid myGridDataView,IDataGridClass myDataGridClass,IProgramContext myprogramContext):this()
		{
			//InitializeComponent();
			this.programContext = myprogramContext;
			path = myPath;
			dataGridClass = myDataGridClass;
			this.gridDetails = myGridDataView;
			dataGrid = dataGridClass.DataGrid;
			this.ConfigurationDate();
			this.checkBoxShortSell.Checked = this.programContext.Configuration.TradeShortSellAllowed ; 
			this.checkBoxShortSellOtherSystem.Checked = this.programContext.Configuration.TradeShortSellOtherFile; 
			

			this.checkBoxStopLoss.Checked = this.programContext.Configuration.TradeStopLoss ;
			this.checkBoxStopWin.Checked = this.programContext.Configuration.TradeStopWin ;
			this.checkBoxIntradayTrade.Checked = this.programContext.Configuration.IntradayModus ;
			this.checkBoxFuturesTrade.Checked = this.programContext.Configuration.FuturesTrade;
            this.checkBoxWebUpdateOnlyLast200.Checked = this.programContext.Configuration.WebUpdate_Only200;
            this.datePickerUpdateStart.Value = this.programContext.Configuration.Dates.DateMinWebupdate;
            this.datePickerUpdateEnd.Value = this.programContext.Configuration.Dates.DateMaxWebupdate;

			this.checkBoxDynamicLimit.Checked = this.programContext.Configuration.TradeStopLossDynamic;



			if(this.programContext.Configuration.TradeMoneyType == CUtil.TradeMoneyType.TradeWithAllMoney)
			{
				this.checkBoxTrade10000.Checked = true;
			}
            if (this.programContext.Configuration.TradeMoneyType == CUtil.TradeMoneyType.TradeOneShare)
            {
                this.checkBoxTradeOneShare.Checked = true;
            }
			else
			{
				this.checkBoxTrade10000.Checked = false;
			}

			this.textBoxStopLoss.Text = this.programContext.Configuration.TradeStopLossPercentage.ToString();
			this.textBoxStopWin.Text = this.programContext.Configuration.TradeStopWinPercentage.ToString();


			this.textBoxIntradaySaveInterval.Text = this.programContext.Configuration.IntradayDataSaveInterval.ToString();
			this.textBoxDynamicLimit.Text = this.programContext.Configuration.TradeStopLossDynamicPercentage.ToString();

            this.comboBoxProgramMode.Items.Add(ProgramModes.Chart.ToString());
            this.comboBoxProgramMode.Items.Add(ProgramModes.Realtime.ToString());
            this.comboBoxProgramMode.Items.Add(ProgramModes.Simulation.ToString());
            this.comboBoxProgramMode.Items.Add(ProgramModes.UserTrade.ToString());

            SetProgramMode();

            SetPath();


			
		}

		public CStock.QuoteWriter QuoteWriter
		{
			get
			{
				if(this.quoteWriter == null)
                    this.quoteWriter = new CStock.QuoteWriter(this.programContext);
				return this.quoteWriter;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="disposing"></param>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            this.components = new System.ComponentModel.Container();
            this.tabPageList = new System.Windows.Forms.TabPage();
            this.buttonSimpleDefault = new EForms.EButton();
            this.buttonDefault = new EForms.EButton();
            this.buttonSave = new EForms.EButton();
            this.tabPageGrid = new System.Windows.Forms.TabPage();
            this.buttonDefaultGrid = new EForms.EButton();
            this.buttonSimpleDefaultGrid = new EForms.EButton();
            this.buttonSaveGrid = new EForms.EButton();
            this.tabControl1 = new System.Windows.Forms.TabControl();
            this.tabPageGeneral = new System.Windows.Forms.TabPage();
            this.gbxSimulation = new System.Windows.Forms.GroupBox();
            this.dateTimePickerSimulationMin = new System.Windows.Forms.DateTimePicker();
            this.label6 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.dateTimePickerSimulationMax = new System.Windows.Forms.DateTimePicker();
            this.gbxUserTradings = new System.Windows.Forms.GroupBox();
            this.label3 = new System.Windows.Forms.Label();
            this.datePickerTradeMin = new System.Windows.Forms.DateTimePicker();
            this.label4 = new System.Windows.Forms.Label();
            this.datePickerTradeMax = new System.Windows.Forms.DateTimePicker();
            this.gbxChart = new System.Windows.Forms.GroupBox();
            this.labelGraphDateStart = new System.Windows.Forms.Label();
            this.datePickerChartMin = new System.Windows.Forms.DateTimePicker();
            this.labelGraphDateEnd = new System.Windows.Forms.Label();
            this.datePickerCharMax = new System.Windows.Forms.DateTimePicker();
            this.comboBoxProgramMode = new System.Windows.Forms.ComboBox();
            this.label15 = new System.Windows.Forms.Label();
            this.buttonDateDefault = new EForms.EButton();
            this.buttonDateSave = new EForms.EButton();
            this.tabPageTrade = new System.Windows.Forms.TabPage();
            this.checkBoxTradeOneShare = new System.Windows.Forms.CheckBox();
            this.labelDynamicLimit = new System.Windows.Forms.Label();
            this.textBoxDynamicLimit = new System.Windows.Forms.TextBox();
            this.checkBoxDynamicLimit = new System.Windows.Forms.CheckBox();
            this.checkBoxFuturesTrade = new System.Windows.Forms.CheckBox();
            this.checkBoxIntradayTrade = new System.Windows.Forms.CheckBox();
            this.checkBoxShortSellOtherSystem = new System.Windows.Forms.CheckBox();
            this.checkBoxTrade10000 = new System.Windows.Forms.CheckBox();
            this.labelStopWin = new System.Windows.Forms.Label();
            this.textBoxStopWin = new System.Windows.Forms.TextBox();
            this.checkBoxStopWin = new System.Windows.Forms.CheckBox();
            this.labelStopLoss = new System.Windows.Forms.Label();
            this.textBoxStopLoss = new System.Windows.Forms.TextBox();
            this.checkBoxStopLoss = new System.Windows.Forms.CheckBox();
            this.checkBoxShortSell = new System.Windows.Forms.CheckBox();
            this.tabPageStockGraph = new System.Windows.Forms.TabPage();
            this.buttonDefaultDates = new EForms.EButton();
            this.tabPageUpdateQuotes = new System.Windows.Forms.TabPage();
            this.datePickerUpdateStart = new System.Windows.Forms.DateTimePicker();
            this.label16 = new System.Windows.Forms.Label();
            this.checkBoxWebUpdateOnlyLast200 = new System.Windows.Forms.CheckBox();
            this.buttonUpdate = new EForms.EButton();
            this.buttonExtractZipFile = new EForms.EButton();
            this.buttonUpdateQuotes = new EForms.EButton();
            this.buttonDownloadUpdateFile = new EForms.EButton();
            this.labelDateEnd = new System.Windows.Forms.Label();
            this.datePickerUpdateEnd = new System.Windows.Forms.DateTimePicker();
            this.tabPageTree = new System.Windows.Forms.TabPage();
            this.tabPagetabPageIntraday = new System.Windows.Forms.TabPage();
            this.buttonDefaultIntraday = new EForms.EButton();
            this.textBoxIntradaySaveInterval = new System.Windows.Forms.TextBox();
            this.label10 = new System.Windows.Forms.Label();
            this.label8 = new System.Windows.Forms.Label();
            this.dateTimePickerIntraday = new System.Windows.Forms.DateTimePicker();
            this.label9 = new System.Windows.Forms.Label();
            this.buttonSaveIntraday = new EForms.EButton();
            this.tabPagePath = new System.Windows.Forms.TabPage();
            this.buttonBrowseDirectory = new System.Windows.Forms.Button();
            this.buttonBrowsePath = new System.Windows.Forms.Button();
            this.textBoxID = new System.Windows.Forms.TextBox();
            this.label14 = new System.Windows.Forms.Label();
            this.textBoxDataDirectory = new System.Windows.Forms.TextBox();
            this.label13 = new System.Windows.Forms.Label();
            this.textBoxPath = new System.Windows.Forms.TextBox();
            this.label12 = new System.Windows.Forms.Label();
            this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
            this.buttonOK = new EForms.EButton();
            this.buttonCancel = new EForms.EButton();
            this.tabPageList.SuspendLayout();
            this.tabPageGrid.SuspendLayout();
            this.tabControl1.SuspendLayout();
            this.tabPageGeneral.SuspendLayout();
            this.gbxSimulation.SuspendLayout();
            this.gbxUserTradings.SuspendLayout();
            this.gbxChart.SuspendLayout();
            this.tabPageTrade.SuspendLayout();
            this.tabPageStockGraph.SuspendLayout();
            this.tabPageUpdateQuotes.SuspendLayout();
            this.tabPagetabPageIntraday.SuspendLayout();
            this.tabPagePath.SuspendLayout();
            this.SuspendLayout();
            // 
            // tabPageList
            // 
            this.tabPageList.Controls.Add(this.buttonSimpleDefault);
            this.tabPageList.Controls.Add(this.buttonDefault);
            this.tabPageList.Controls.Add(this.buttonSave);
            this.tabPageList.Location = new System.Drawing.Point(4, 22);
            this.tabPageList.Name = "tabPageList";
            this.tabPageList.Size = new System.Drawing.Size(752, 286);
            this.tabPageList.TabIndex = 0;
            this.tabPageList.Text = "List";
            this.tabPageList.UseVisualStyleBackColor = true;
            // 
            // buttonSimpleDefault
            // 
            this.buttonSimpleDefault.DialogResult = System.Windows.Forms.DialogResult.None;
            this.buttonSimpleDefault.Font = new System.Drawing.Font("Verdana", 9F);
            this.buttonSimpleDefault.Location = new System.Drawing.Point(18, 13);
            this.buttonSimpleDefault.Name = "buttonSimpleDefault";
            this.buttonSimpleDefault.Size = new System.Drawing.Size(174, 24);
            this.buttonSimpleDefault.TabIndex = 28;
            this.buttonSimpleDefault.Text = "Simple Default";
            this.buttonSimpleDefault.Click += new System.EventHandler(this.buttonSimpleDefault_Click);
            // 
            // buttonDefault
            // 
            this.buttonDefault.DialogResult = System.Windows.Forms.DialogResult.None;
            this.buttonDefault.Font = new System.Drawing.Font("Verdana", 9F);
            this.buttonDefault.Location = new System.Drawing.Point(18, 43);
            this.buttonDefault.Name = "buttonDefault";
            this.buttonDefault.Size = new System.Drawing.Size(88, 24);
            this.buttonDefault.TabIndex = 29;
            this.buttonDefault.Text = "Default";
            this.buttonDefault.Click += new System.EventHandler(this.buttonDefault_Click);
            // 
            // buttonSave
            // 
            this.buttonSave.DialogResult = System.Windows.Forms.DialogResult.None;
            this.buttonSave.Font = new System.Drawing.Font("Verdana", 9F);
            this.buttonSave.Location = new System.Drawing.Point(112, 43);
            this.buttonSave.Name = "buttonSave";
            this.buttonSave.Size = new System.Drawing.Size(80, 24);
            this.buttonSave.TabIndex = 30;
            this.buttonSave.Text = "Save";
            this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
            // 
            // tabPageGrid
            // 
            this.tabPageGrid.Controls.Add(this.buttonDefaultGrid);
            this.tabPageGrid.Controls.Add(this.buttonSimpleDefaultGrid);
            this.tabPageGrid.Controls.Add(this.buttonSaveGrid);
            this.tabPageGrid.Location = new System.Drawing.Point(4, 22);
            this.tabPageGrid.Name = "tabPageGrid";
            this.tabPageGrid.Size = new System.Drawing.Size(752, 286);
            this.tabPageGrid.TabIndex = 2;
            this.tabPageGrid.Text = "Grid";
            this.tabPageGrid.UseVisualStyleBackColor = true;
            // 
            // buttonDefaultGrid
            // 
            this.buttonDefaultGrid.DialogResult = System.Windows.Forms.DialogResult.None;
            this.buttonDefaultGrid.Font = new System.Drawing.Font("Verdana", 9F);
            this.buttonDefaultGrid.Location = new System.Drawing.Point(15, 40);
            this.buttonDefaultGrid.Name = "buttonDefaultGrid";
            this.buttonDefaultGrid.Size = new System.Drawing.Size(88, 24);
            this.buttonDefaultGrid.TabIndex = 20;
            this.buttonDefaultGrid.Text = "Default";
            this.buttonDefaultGrid.Click += new System.EventHandler(this.buttonDefaultGrid_Click);
            // 
            // buttonSimpleDefaultGrid
            // 
            this.buttonSimpleDefaultGrid.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(212)))), ((int)(((byte)(208)))), ((int)(((byte)(200)))));
            this.buttonSimpleDefaultGrid.DialogResult = System.Windows.Forms.DialogResult.None;
            this.buttonSimpleDefaultGrid.Font = new System.Drawing.Font("Verdana", 9F);
            this.buttonSimpleDefaultGrid.Location = new System.Drawing.Point(15, 10);
            this.buttonSimpleDefaultGrid.Name = "buttonSimpleDefaultGrid";
            this.buttonSimpleDefaultGrid.Size = new System.Drawing.Size(174, 24);
            this.buttonSimpleDefaultGrid.TabIndex = 19;
            this.buttonSimpleDefaultGrid.Text = "Simple Default";
            this.buttonSimpleDefaultGrid.Click += new System.EventHandler(this.buttonSimpleDefaultGrid_Click);
            // 
            // buttonSaveGrid
            // 
            this.buttonSaveGrid.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(212)))), ((int)(((byte)(208)))), ((int)(((byte)(200)))));
            this.buttonSaveGrid.DialogResult = System.Windows.Forms.DialogResult.None;
            this.buttonSaveGrid.Font = new System.Drawing.Font("Verdana", 9F);
            this.buttonSaveGrid.Location = new System.Drawing.Point(109, 40);
            this.buttonSaveGrid.Name = "buttonSaveGrid";
            this.buttonSaveGrid.Size = new System.Drawing.Size(80, 24);
            this.buttonSaveGrid.TabIndex = 21;
            this.buttonSaveGrid.Text = "Save";
            this.buttonSaveGrid.Click += new System.EventHandler(this.buttonSaveGrid_Click);
            // 
            // tabControl1
            // 
            this.tabControl1.Controls.Add(this.tabPageGeneral);
            this.tabControl1.Controls.Add(this.tabPageTrade);
            this.tabControl1.Controls.Add(this.tabPageStockGraph);
            this.tabControl1.Controls.Add(this.tabPageGrid);
            this.tabControl1.Controls.Add(this.tabPageUpdateQuotes);
            this.tabControl1.Controls.Add(this.tabPageTree);
            this.tabControl1.Controls.Add(this.tabPageList);
            this.tabControl1.Controls.Add(this.tabPagetabPageIntraday);
            this.tabControl1.Controls.Add(this.tabPagePath);
            this.tabControl1.Dock = System.Windows.Forms.DockStyle.Top;
            this.tabControl1.Location = new System.Drawing.Point(0, 0);
            this.tabControl1.Name = "tabControl1";
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.Size = new System.Drawing.Size(760, 312);
            this.tabControl1.TabIndex = 0;
            this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
            // 
            // tabPageGeneral
            // 
            this.tabPageGeneral.Controls.Add(this.gbxSimulation);
            this.tabPageGeneral.Controls.Add(this.gbxUserTradings);
            this.tabPageGeneral.Controls.Add(this.gbxChart);
            this.tabPageGeneral.Controls.Add(this.comboBoxProgramMode);
            this.tabPageGeneral.Controls.Add(this.label15);
            this.tabPageGeneral.Controls.Add(this.buttonDateDefault);
            this.tabPageGeneral.Controls.Add(this.buttonDateSave);
            this.tabPageGeneral.Location = new System.Drawing.Point(4, 22);
            this.tabPageGeneral.Name = "tabPageGeneral";
            this.tabPageGeneral.Size = new System.Drawing.Size(752, 286);
            this.tabPageGeneral.TabIndex = 4;
            this.tabPageGeneral.Text = "General";
            this.tabPageGeneral.UseVisualStyleBackColor = true;
            // 
            // gbxSimulation
            // 
            this.gbxSimulation.Controls.Add(this.dateTimePickerSimulationMin);
            this.gbxSimulation.Controls.Add(this.label6);
            this.gbxSimulation.Controls.Add(this.label5);
            this.gbxSimulation.Controls.Add(this.dateTimePickerSimulationMax);
            this.gbxSimulation.Location = new System.Drawing.Point(6, 159);
            this.gbxSimulation.Name = "gbxSimulation";
            this.gbxSimulation.Size = new System.Drawing.Size(502, 54);
            this.gbxSimulation.TabIndex = 31;
            this.gbxSimulation.TabStop = false;
            this.gbxSimulation.Text = "Simulation";
            // 
            // dateTimePickerSimulationMin
            // 
            this.dateTimePickerSimulationMin.Location = new System.Drawing.Point(48, 19);
            this.dateTimePickerSimulationMin.Name = "dateTimePickerSimulationMin";
            this.dateTimePickerSimulationMin.Size = new System.Drawing.Size(200, 20);
            this.dateTimePickerSimulationMin.TabIndex = 4;
            // 
            // label6
            // 
            this.label6.Location = new System.Drawing.Point(10, 23);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(40, 24);
            this.label6.TabIndex = 25;
            this.label6.Text = "From";
            // 
            // label5
            // 
            this.label5.Location = new System.Drawing.Point(253, 23);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(29, 20);
            this.label5.TabIndex = 26;
            this.label5.Text = "To";
            // 
            // dateTimePickerSimulationMax
            // 
            this.dateTimePickerSimulationMax.Location = new System.Drawing.Point(287, 19);
            this.dateTimePickerSimulationMax.Name = "dateTimePickerSimulationMax";
            this.dateTimePickerSimulationMax.Size = new System.Drawing.Size(200, 20);
            this.dateTimePickerSimulationMax.TabIndex = 5;
            // 
            // gbxUserTradings
            // 
            this.gbxUserTradings.Controls.Add(this.label3);
            this.gbxUserTradings.Controls.Add(this.datePickerTradeMin);
            this.gbxUserTradings.Controls.Add(this.label4);
            this.gbxUserTradings.Controls.Add(this.datePickerTradeMax);
            this.gbxUserTradings.Location = new System.Drawing.Point(6, 99);
            this.gbxUserTradings.Name = "gbxUserTradings";
            this.gbxUserTradings.Size = new System.Drawing.Size(502, 54);
            this.gbxUserTradings.TabIndex = 30;
            this.gbxUserTradings.TabStop = false;
            this.gbxUserTradings.Text = "User tradings";
            // 
            // label3
            // 
            this.label3.Location = new System.Drawing.Point(10, 20);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(38, 20);
            this.label3.TabIndex = 20;
            this.label3.Text = "From";
            // 
            // datePickerTradeMin
            // 
            this.datePickerTradeMin.Location = new System.Drawing.Point(48, 16);
            this.datePickerTradeMin.Name = "datePickerTradeMin";
            this.datePickerTradeMin.Size = new System.Drawing.Size(200, 20);
            this.datePickerTradeMin.TabIndex = 2;
            // 
            // label4
            // 
            this.label4.Location = new System.Drawing.Point(254, 20);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(27, 20);
            this.label4.TabIndex = 21;
            this.label4.Text = "To";
            // 
            // datePickerTradeMax
            // 
            this.datePickerTradeMax.Location = new System.Drawing.Point(287, 16);
            this.datePickerTradeMax.Name = "datePickerTradeMax";
            this.datePickerTradeMax.Size = new System.Drawing.Size(200, 20);
            this.datePickerTradeMax.TabIndex = 3;
            // 
            // gbxChart
            // 
            this.gbxChart.Controls.Add(this.labelGraphDateStart);
            this.gbxChart.Controls.Add(this.datePickerChartMin);
            this.gbxChart.Controls.Add(this.labelGraphDateEnd);
            this.gbxChart.Controls.Add(this.datePickerCharMax);
            this.gbxChart.Location = new System.Drawing.Point(6, 39);
            this.gbxChart.Name = "gbxChart";
            this.gbxChart.Size = new System.Drawing.Size(502, 54);
            this.gbxChart.TabIndex = 29;
            this.gbxChart.TabStop = false;
            this.gbxChart.Text = "Chart";
            // 
            // labelGraphDateStart
            // 
            this.labelGraphDateStart.Location = new System.Drawing.Point(10, 21);
            this.labelGraphDateStart.Name = "labelGraphDateStart";
            this.labelGraphDateStart.Size = new System.Drawing.Size(38, 16);
            this.labelGraphDateStart.TabIndex = 9;
            this.labelGraphDateStart.Text = "From";
            // 
            // datePickerChartMin
            // 
            this.datePickerChartMin.Location = new System.Drawing.Point(48, 17);
            this.datePickerChartMin.Name = "datePickerChartMin";
            this.datePickerChartMin.Size = new System.Drawing.Size(200, 20);
            this.datePickerChartMin.TabIndex = 0;
            // 
            // labelGraphDateEnd
            // 
            this.labelGraphDateEnd.Location = new System.Drawing.Point(254, 21);
            this.labelGraphDateEnd.Name = "labelGraphDateEnd";
            this.labelGraphDateEnd.Size = new System.Drawing.Size(28, 16);
            this.labelGraphDateEnd.TabIndex = 11;
            this.labelGraphDateEnd.Text = "To";
            // 
            // datePickerCharMax
            // 
            this.datePickerCharMax.Location = new System.Drawing.Point(288, 17);
            this.datePickerCharMax.Name = "datePickerCharMax";
            this.datePickerCharMax.Size = new System.Drawing.Size(200, 20);
            this.datePickerCharMax.TabIndex = 1;
            // 
            // comboBoxProgramMode
            // 
            this.comboBoxProgramMode.FormattingEnabled = true;
            this.comboBoxProgramMode.Location = new System.Drawing.Point(146, 12);
            this.comboBoxProgramMode.Name = "comboBoxProgramMode";
            this.comboBoxProgramMode.Size = new System.Drawing.Size(121, 21);
            this.comboBoxProgramMode.TabIndex = 28;
            // 
            // label15
            // 
            this.label15.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label15.Location = new System.Drawing.Point(3, 11);
            this.label15.Name = "label15";
            this.label15.Size = new System.Drawing.Size(137, 22);
            this.label15.TabIndex = 27;
            this.label15.Text = "Program Mode";
            // 
            // buttonDateDefault
            // 
            this.buttonDateDefault.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(212)))), ((int)(((byte)(208)))), ((int)(((byte)(200)))));
            this.buttonDateDefault.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.buttonDateDefault.Font = new System.Drawing.Font("Verdana", 9F);
            this.buttonDateDefault.Location = new System.Drawing.Point(260, 243);
            this.buttonDateDefault.Name = "buttonDateDefault";
            this.buttonDateDefault.Size = new System.Drawing.Size(104, 40);
            this.buttonDateDefault.TabIndex = 6;
            this.buttonDateDefault.Text = "Default dates";
            this.buttonDateDefault.Click += new System.EventHandler(this.buttonDateDefault_Click);
            // 
            // buttonDateSave
            // 
            this.buttonDateSave.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(212)))), ((int)(((byte)(208)))), ((int)(((byte)(200)))));
            this.buttonDateSave.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.buttonDateSave.Font = new System.Drawing.Font("Verdana", 9F);
            this.buttonDateSave.Location = new System.Drawing.Point(404, 243);
            this.buttonDateSave.Name = "buttonDateSave";
            this.buttonDateSave.Size = new System.Drawing.Size(104, 40);
            this.buttonDateSave.TabIndex = 7;
            this.buttonDateSave.Text = "Save Dates";
            this.buttonDateSave.Click += new System.EventHandler(this.buttonDateSave_Click);
            // 
            // tabPageTrade
            // 
            this.tabPageTrade.Controls.Add(this.checkBoxTradeOneShare);
            this.tabPageTrade.Controls.Add(this.labelDynamicLimit);
            this.tabPageTrade.Controls.Add(this.textBoxDynamicLimit);
            this.tabPageTrade.Controls.Add(this.checkBoxDynamicLimit);
            this.tabPageTrade.Controls.Add(this.checkBoxFuturesTrade);
            this.tabPageTrade.Controls.Add(this.checkBoxIntradayTrade);
            this.tabPageTrade.Controls.Add(this.checkBoxShortSellOtherSystem);
            this.tabPageTrade.Controls.Add(this.checkBoxTrade10000);
            this.tabPageTrade.Controls.Add(this.labelStopWin);
            this.tabPageTrade.Controls.Add(this.textBoxStopWin);
            this.tabPageTrade.Controls.Add(this.checkBoxStopWin);
            this.tabPageTrade.Controls.Add(this.labelStopLoss);
            this.tabPageTrade.Controls.Add(this.textBoxStopLoss);
            this.tabPageTrade.Controls.Add(this.checkBoxStopLoss);
            this.tabPageTrade.Controls.Add(this.checkBoxShortSell);
            this.tabPageTrade.ImeMode = System.Windows.Forms.ImeMode.On;
            this.tabPageTrade.Location = new System.Drawing.Point(4, 22);
            this.tabPageTrade.Name = "tabPageTrade";
            this.tabPageTrade.Size = new System.Drawing.Size(752, 286);
            this.tabPageTrade.TabIndex = 5;
            this.tabPageTrade.Text = "Trade";
            this.tabPageTrade.UseVisualStyleBackColor = true;
            // 
            // checkBoxTradeOneShare
            // 
            this.checkBoxTradeOneShare.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.checkBoxTradeOneShare.Location = new System.Drawing.Point(8, 103);
            this.checkBoxTradeOneShare.Name = "checkBoxTradeOneShare";
            this.checkBoxTradeOneShare.Size = new System.Drawing.Size(176, 24);
            this.checkBoxTradeOneShare.TabIndex = 19;
            this.checkBoxTradeOneShare.Text = "Trade one share";
            // 
            // labelDynamicLimit
            // 
            this.labelDynamicLimit.Enabled = false;
            this.labelDynamicLimit.Location = new System.Drawing.Point(227, 136);
            this.labelDynamicLimit.Name = "labelDynamicLimit";
            this.labelDynamicLimit.Size = new System.Drawing.Size(136, 20);
            this.labelDynamicLimit.TabIndex = 13;
            this.labelDynamicLimit.Text = "% Dynamic Limit";
            // 
            // textBoxDynamicLimit
            // 
            this.textBoxDynamicLimit.Enabled = false;
            this.textBoxDynamicLimit.Location = new System.Drawing.Point(195, 133);
            this.textBoxDynamicLimit.Name = "textBoxDynamicLimit";
            this.textBoxDynamicLimit.Size = new System.Drawing.Size(32, 20);
            this.textBoxDynamicLimit.TabIndex = 16;
            // 
            // checkBoxDynamicLimit
            // 
            this.checkBoxDynamicLimit.Location = new System.Drawing.Point(195, 111);
            this.checkBoxDynamicLimit.Name = "checkBoxDynamicLimit";
            this.checkBoxDynamicLimit.Size = new System.Drawing.Size(208, 24);
            this.checkBoxDynamicLimit.TabIndex = 15;
            this.checkBoxDynamicLimit.Text = "StopLoss with dynamic limit";
            this.checkBoxDynamicLimit.CheckedChanged += new System.EventHandler(this.checkBoxDynamicLimit_CheckedChanged);
            // 
            // checkBoxFuturesTrade
            // 
            this.checkBoxFuturesTrade.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.checkBoxFuturesTrade.Location = new System.Drawing.Point(8, 43);
            this.checkBoxFuturesTrade.Name = "checkBoxFuturesTrade";
            this.checkBoxFuturesTrade.Size = new System.Drawing.Size(176, 24);
            this.checkBoxFuturesTrade.TabIndex = 9;
            this.checkBoxFuturesTrade.Text = "Futures Trade";
            // 
            // checkBoxIntradayTrade
            // 
            this.checkBoxIntradayTrade.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.checkBoxIntradayTrade.Location = new System.Drawing.Point(8, 13);
            this.checkBoxIntradayTrade.Name = "checkBoxIntradayTrade";
            this.checkBoxIntradayTrade.Size = new System.Drawing.Size(176, 24);
            this.checkBoxIntradayTrade.TabIndex = 8;
            this.checkBoxIntradayTrade.Text = "Intraday Trade";
            // 
            // checkBoxShortSellOtherSystem
            // 
            this.checkBoxShortSellOtherSystem.Location = new System.Drawing.Point(369, 43);
            this.checkBoxShortSellOtherSystem.Name = "checkBoxShortSellOtherSystem";
            this.checkBoxShortSellOtherSystem.Size = new System.Drawing.Size(248, 24);
            this.checkBoxShortSellOtherSystem.TabIndex = 18;
            this.checkBoxShortSellOtherSystem.Text = "Short Sell Trading with other trade System";
            // 
            // checkBoxTrade10000
            // 
            this.checkBoxTrade10000.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.checkBoxTrade10000.Location = new System.Drawing.Point(8, 73);
            this.checkBoxTrade10000.Name = "checkBoxTrade10000";
            this.checkBoxTrade10000.Size = new System.Drawing.Size(176, 24);
            this.checkBoxTrade10000.TabIndex = 10;
            this.checkBoxTrade10000.Text = "Trade with all the money";
            // 
            // labelStopWin
            // 
            this.labelStopWin.Enabled = false;
            this.labelStopWin.Location = new System.Drawing.Point(227, 41);
            this.labelStopWin.Name = "labelStopWin";
            this.labelStopWin.Size = new System.Drawing.Size(136, 20);
            this.labelStopWin.TabIndex = 6;
            this.labelStopWin.Text = "% Stop Win";
            // 
            // textBoxStopWin
            // 
            this.textBoxStopWin.Enabled = false;
            this.textBoxStopWin.Location = new System.Drawing.Point(195, 38);
            this.textBoxStopWin.Name = "textBoxStopWin";
            this.textBoxStopWin.Size = new System.Drawing.Size(32, 20);
            this.textBoxStopWin.TabIndex = 12;
            // 
            // checkBoxStopWin
            // 
            this.checkBoxStopWin.Location = new System.Drawing.Point(195, 13);
            this.checkBoxStopWin.Name = "checkBoxStopWin";
            this.checkBoxStopWin.Size = new System.Drawing.Size(168, 24);
            this.checkBoxStopWin.TabIndex = 11;
            this.checkBoxStopWin.Text = "Enable Stop Win Trade";
            this.checkBoxStopWin.CheckedChanged += new System.EventHandler(this.checkBoxStopWin_CheckedChanged);
            // 
            // labelStopLoss
            // 
            this.labelStopLoss.Enabled = false;
            this.labelStopLoss.Location = new System.Drawing.Point(228, 90);
            this.labelStopLoss.Name = "labelStopLoss";
            this.labelStopLoss.Size = new System.Drawing.Size(136, 20);
            this.labelStopLoss.TabIndex = 3;
            this.labelStopLoss.Text = "% Stop Loss";
            // 
            // textBoxStopLoss
            // 
            this.textBoxStopLoss.Enabled = false;
            this.textBoxStopLoss.Location = new System.Drawing.Point(195, 87);
            this.textBoxStopLoss.Name = "textBoxStopLoss";
            this.textBoxStopLoss.Size = new System.Drawing.Size(32, 20);
            this.textBoxStopLoss.TabIndex = 14;
            // 
            // checkBoxStopLoss
            // 
            this.checkBoxStopLoss.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.checkBoxStopLoss.Location = new System.Drawing.Point(195, 64);
            this.checkBoxStopLoss.Name = "checkBoxStopLoss";
            this.checkBoxStopLoss.Size = new System.Drawing.Size(168, 24);
            this.checkBoxStopLoss.TabIndex = 13;
            this.checkBoxStopLoss.Text = "Enable StopLoss Trade";
            this.checkBoxStopLoss.CheckedChanged += new System.EventHandler(this.checkBoxStopLoss_CheckedChanged);
            // 
            // checkBoxShortSell
            // 
            this.checkBoxShortSell.Location = new System.Drawing.Point(369, 13);
            this.checkBoxShortSell.Name = "checkBoxShortSell";
            this.checkBoxShortSell.Size = new System.Drawing.Size(176, 24);
            this.checkBoxShortSell.TabIndex = 17;
            this.checkBoxShortSell.Text = "Enable Short Sell trade";
            // 
            // tabPageStockGraph
            // 
            this.tabPageStockGraph.Controls.Add(this.buttonDefaultDates);
            this.tabPageStockGraph.Location = new System.Drawing.Point(4, 22);
            this.tabPageStockGraph.Name = "tabPageStockGraph";
            this.tabPageStockGraph.Size = new System.Drawing.Size(752, 286);
            this.tabPageStockGraph.TabIndex = 3;
            this.tabPageStockGraph.Text = "Graph";
            this.tabPageStockGraph.UseVisualStyleBackColor = true;
            // 
            // buttonDefaultDates
            // 
            this.buttonDefaultDates.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(212)))), ((int)(((byte)(208)))), ((int)(((byte)(200)))));
            this.buttonDefaultDates.DialogResult = System.Windows.Forms.DialogResult.None;
            this.buttonDefaultDates.Font = new System.Drawing.Font("Verdana", 9F);
            this.buttonDefaultDates.Location = new System.Drawing.Point(21, 18);
            this.buttonDefaultDates.Name = "buttonDefaultDates";
            this.buttonDefaultDates.Size = new System.Drawing.Size(104, 24);
            this.buttonDefaultDates.TabIndex = 18;
            this.buttonDefaultDates.Text = "Default Dates";
            // 
            // tabPageUpdateQuotes
            // 
            this.tabPageUpdateQuotes.Controls.Add(this.datePickerUpdateStart);
            this.tabPageUpdateQuotes.Controls.Add(this.label16);
            this.tabPageUpdateQuotes.Controls.Add(this.checkBoxWebUpdateOnlyLast200);
            this.tabPageUpdateQuotes.Controls.Add(this.buttonUpdate);
            this.tabPageUpdateQuotes.Controls.Add(this.buttonExtractZipFile);
            this.tabPageUpdateQuotes.Controls.Add(this.buttonUpdateQuotes);
            this.tabPageUpdateQuotes.Controls.Add(this.buttonDownloadUpdateFile);
            this.tabPageUpdateQuotes.Controls.Add(this.labelDateEnd);
            this.tabPageUpdateQuotes.Controls.Add(this.datePickerUpdateEnd);
            this.tabPageUpdateQuotes.Location = new System.Drawing.Point(4, 22);
            this.tabPageUpdateQuotes.Name = "tabPageUpdateQuotes";
            this.tabPageUpdateQuotes.Size = new System.Drawing.Size(752, 286);
            this.tabPageUpdateQuotes.TabIndex = 6;
            this.tabPageUpdateQuotes.Text = "Update quotes";
            this.tabPageUpdateQuotes.UseVisualStyleBackColor = true;
            // 
            // datePickerUpdateStart
            // 
            this.datePickerUpdateStart.Location = new System.Drawing.Point(151, 10);
            this.datePickerUpdateStart.Name = "datePickerUpdateStart";
            this.datePickerUpdateStart.Size = new System.Drawing.Size(200, 20);
            this.datePickerUpdateStart.TabIndex = 32;
            // 
            // label16
            // 
            this.label16.Location = new System.Drawing.Point(13, 14);
            this.label16.Name = "label16";
            this.label16.Size = new System.Drawing.Size(136, 16);
            this.label16.TabIndex = 31;
            this.label16.Text = "Webupdate DateStart";
            // 
            // checkBoxWebUpdateOnlyLast200
            // 
            this.checkBoxWebUpdateOnlyLast200.Checked = true;
            this.checkBoxWebUpdateOnlyLast200.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBoxWebUpdateOnlyLast200.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.checkBoxWebUpdateOnlyLast200.Location = new System.Drawing.Point(151, 65);
            this.checkBoxWebUpdateOnlyLast200.Name = "checkBoxWebUpdateOnlyLast200";
            this.checkBoxWebUpdateOnlyLast200.Size = new System.Drawing.Size(176, 24);
            this.checkBoxWebUpdateOnlyLast200.TabIndex = 30;
            this.checkBoxWebUpdateOnlyLast200.Text = "Webupdate - only last 200 data";
            // 
            // buttonUpdate
            // 
            this.buttonUpdate.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(212)))), ((int)(((byte)(208)))), ((int)(((byte)(200)))));
            this.buttonUpdate.DialogResult = System.Windows.Forms.DialogResult.None;
            this.buttonUpdate.Font = new System.Drawing.Font("Verdana", 9F);
            this.buttonUpdate.Location = new System.Drawing.Point(576, 46);
            this.buttonUpdate.Name = "buttonUpdate";
            this.buttonUpdate.Size = new System.Drawing.Size(168, 30);
            this.buttonUpdate.TabIndex = 26;
            this.buttonUpdate.Text = "Update";
            this.buttonUpdate.Visible = false;
            this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click);
            // 
            // buttonExtractZipFile
            // 
            this.buttonExtractZipFile.DialogResult = System.Windows.Forms.DialogResult.None;
            this.buttonExtractZipFile.Location = new System.Drawing.Point(0, 0);
            this.buttonExtractZipFile.Name = "buttonExtractZipFile";
            this.buttonExtractZipFile.Size = new System.Drawing.Size(0, 0);
            this.buttonExtractZipFile.TabIndex = 27;
            // 
            // buttonUpdateQuotes
            // 
            this.buttonUpdateQuotes.DialogResult = System.Windows.Forms.DialogResult.None;
            this.buttonUpdateQuotes.Location = new System.Drawing.Point(0, 0);
            this.buttonUpdateQuotes.Name = "buttonUpdateQuotes";
            this.buttonUpdateQuotes.Size = new System.Drawing.Size(0, 0);
            this.buttonUpdateQuotes.TabIndex = 28;
            // 
            // buttonDownloadUpdateFile
            // 
            this.buttonDownloadUpdateFile.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(212)))), ((int)(((byte)(208)))), ((int)(((byte)(200)))));
            this.buttonDownloadUpdateFile.DialogResult = System.Windows.Forms.DialogResult.None;
            this.buttonDownloadUpdateFile.Font = new System.Drawing.Font("Verdana", 9F);
            this.buttonDownloadUpdateFile.Location = new System.Drawing.Point(576, 10);
            this.buttonDownloadUpdateFile.Name = "buttonDownloadUpdateFile";
            this.buttonDownloadUpdateFile.Size = new System.Drawing.Size(168, 30);
            this.buttonDownloadUpdateFile.TabIndex = 24;
            this.buttonDownloadUpdateFile.Text = "Download Update File";
            this.buttonDownloadUpdateFile.Visible = false;
            this.buttonDownloadUpdateFile.Click += new System.EventHandler(this.buttonDownloadUpdateFile_Click);
            // 
            // labelDateEnd
            // 
            this.labelDateEnd.Location = new System.Drawing.Point(13, 39);
            this.labelDateEnd.Name = "labelDateEnd";
            this.labelDateEnd.Size = new System.Drawing.Size(88, 20);
            this.labelDateEnd.TabIndex = 29;
            this.labelDateEnd.Text = "Date End";
            // 
            // datePickerUpdateEnd
            // 
            this.datePickerUpdateEnd.Location = new System.Drawing.Point(151, 39);
            this.datePickerUpdateEnd.Name = "datePickerUpdateEnd";
            this.datePickerUpdateEnd.Size = new System.Drawing.Size(200, 20);
            this.datePickerUpdateEnd.TabIndex = 23;
            // 
            // tabPageTree
            // 
            this.tabPageTree.Location = new System.Drawing.Point(4, 22);
            this.tabPageTree.Name = "tabPageTree";
            this.tabPageTree.Size = new System.Drawing.Size(752, 286);
            this.tabPageTree.TabIndex = 1;
            this.tabPageTree.Text = "Tree";
            this.tabPageTree.UseVisualStyleBackColor = true;
            // 
            // tabPagetabPageIntraday
            // 
            this.tabPagetabPageIntraday.Controls.Add(this.buttonDefaultIntraday);
            this.tabPagetabPageIntraday.Controls.Add(this.textBoxIntradaySaveInterval);
            this.tabPagetabPageIntraday.Controls.Add(this.label10);
            this.tabPagetabPageIntraday.Controls.Add(this.label8);
            this.tabPagetabPageIntraday.Controls.Add(this.dateTimePickerIntraday);
            this.tabPagetabPageIntraday.Controls.Add(this.label9);
            this.tabPagetabPageIntraday.Controls.Add(this.buttonSaveIntraday);
            this.tabPagetabPageIntraday.Location = new System.Drawing.Point(4, 22);
            this.tabPagetabPageIntraday.Name = "tabPagetabPageIntraday";
            this.tabPagetabPageIntraday.Size = new System.Drawing.Size(752, 286);
            this.tabPagetabPageIntraday.TabIndex = 7;
            this.tabPagetabPageIntraday.Text = "Intraday";
            this.tabPagetabPageIntraday.UseVisualStyleBackColor = true;
            // 
            // buttonDefaultIntraday
            // 
            this.buttonDefaultIntraday.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(212)))), ((int)(((byte)(208)))), ((int)(((byte)(200)))));
            this.buttonDefaultIntraday.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.buttonDefaultIntraday.Font = new System.Drawing.Font("Verdana", 9F);
            this.buttonDefaultIntraday.Location = new System.Drawing.Point(19, 104);
            this.buttonDefaultIntraday.Name = "buttonDefaultIntraday";
            this.buttonDefaultIntraday.Size = new System.Drawing.Size(104, 25);
            this.buttonDefaultIntraday.TabIndex = 33;
            this.buttonDefaultIntraday.Tag = "33";
            this.buttonDefaultIntraday.Text = "Default";
            this.buttonDefaultIntraday.Click += new System.EventHandler(this.buttonDefaultIntraday_Click);
            // 
            // textBoxIntradaySaveInterval
            // 
            this.textBoxIntradaySaveInterval.Location = new System.Drawing.Point(158, 74);
            this.textBoxIntradaySaveInterval.Name = "textBoxIntradaySaveInterval";
            this.textBoxIntradaySaveInterval.Size = new System.Drawing.Size(100, 20);
            this.textBoxIntradaySaveInterval.TabIndex = 32;
            this.textBoxIntradaySaveInterval.Tag = "32";
            // 
            // label10
            // 
            this.label10.Location = new System.Drawing.Point(16, 77);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(136, 24);
            this.label10.TabIndex = 24;
            this.label10.Text = "Interval to save data (s)";
            // 
            // label8
            // 
            this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label8.Location = new System.Drawing.Point(16, 12);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(136, 20);
            this.label8.TabIndex = 21;
            this.label8.Text = "Chart";
            // 
            // dateTimePickerIntraday
            // 
            this.dateTimePickerIntraday.Location = new System.Drawing.Point(58, 42);
            this.dateTimePickerIntraday.Name = "dateTimePickerIntraday";
            this.dateTimePickerIntraday.Size = new System.Drawing.Size(200, 20);
            this.dateTimePickerIntraday.TabIndex = 31;
            this.dateTimePickerIntraday.Tag = "31";
            // 
            // label9
            // 
            this.label9.Location = new System.Drawing.Point(16, 46);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(96, 16);
            this.label9.TabIndex = 19;
            this.label9.Text = "Date";
            // 
            // buttonSaveIntraday
            // 
            this.buttonSaveIntraday.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(212)))), ((int)(((byte)(208)))), ((int)(((byte)(200)))));
            this.buttonSaveIntraday.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.buttonSaveIntraday.Font = new System.Drawing.Font("Verdana", 9F);
            this.buttonSaveIntraday.Location = new System.Drawing.Point(154, 104);
            this.buttonSaveIntraday.Name = "buttonSaveIntraday";
            this.buttonSaveIntraday.Size = new System.Drawing.Size(104, 25);
            this.buttonSaveIntraday.TabIndex = 34;
            this.buttonSaveIntraday.Text = "Save";
            this.buttonSaveIntraday.Click += new System.EventHandler(this.buttonSaveIntraday_Click);
            // 
            // tabPagePath
            // 
            this.tabPagePath.Controls.Add(this.buttonBrowseDirectory);
            this.tabPagePath.Controls.Add(this.buttonBrowsePath);
            this.tabPagePath.Controls.Add(this.textBoxID);
            this.tabPagePath.Controls.Add(this.label14);
            this.tabPagePath.Controls.Add(this.textBoxDataDirectory);
            this.tabPagePath.Controls.Add(this.label13);
            this.tabPagePath.Controls.Add(this.textBoxPath);
            this.tabPagePath.Controls.Add(this.label12);
            this.tabPagePath.Location = new System.Drawing.Point(4, 22);
            this.tabPagePath.Name = "tabPagePath";
            this.tabPagePath.Size = new System.Drawing.Size(752, 286);
            this.tabPagePath.TabIndex = 8;
            this.tabPagePath.Text = "Path";
            this.tabPagePath.UseVisualStyleBackColor = true;
            // 
            // buttonBrowseDirectory
            // 
            this.buttonBrowseDirectory.Location = new System.Drawing.Point(472, 45);
            this.buttonBrowseDirectory.Name = "buttonBrowseDirectory";
            this.buttonBrowseDirectory.Size = new System.Drawing.Size(75, 23);
            this.buttonBrowseDirectory.TabIndex = 40;
            this.buttonBrowseDirectory.Text = "Browse...";
            this.buttonBrowseDirectory.UseVisualStyleBackColor = true;
            this.buttonBrowseDirectory.Click += new System.EventHandler(this.buttonBrowseDirectory_Click);
            // 
            // buttonBrowsePath
            // 
            this.buttonBrowsePath.Location = new System.Drawing.Point(472, 12);
            this.buttonBrowsePath.Name = "buttonBrowsePath";
            this.buttonBrowsePath.Size = new System.Drawing.Size(75, 23);
            this.buttonBrowsePath.TabIndex = 39;
            this.buttonBrowsePath.Text = "Browse...";
            this.buttonBrowsePath.UseVisualStyleBackColor = true;
            this.buttonBrowsePath.Click += new System.EventHandler(this.buttonBrowsePath_Click);
            // 
            // textBoxID
            // 
            this.textBoxID.Location = new System.Drawing.Point(208, 83);
            this.textBoxID.Name = "textBoxID";
            this.textBoxID.Size = new System.Drawing.Size(258, 20);
            this.textBoxID.TabIndex = 38;
            this.textBoxID.Tag = "32";
            // 
            // label14
            // 
            this.label14.Location = new System.Drawing.Point(16, 83);
            this.label14.Name = "label14";
            this.label14.Size = new System.Drawing.Size(136, 24);
            this.label14.TabIndex = 37;
            this.label14.Text = "ID";
            // 
            // textBoxDataDirectory
            // 
            this.textBoxDataDirectory.Location = new System.Drawing.Point(208, 47);
            this.textBoxDataDirectory.Name = "textBoxDataDirectory";
            this.textBoxDataDirectory.Size = new System.Drawing.Size(258, 20);
            this.textBoxDataDirectory.TabIndex = 36;
            this.textBoxDataDirectory.Tag = "32";
            // 
            // label13
            // 
            this.label13.Location = new System.Drawing.Point(16, 47);
            this.label13.Name = "label13";
            this.label13.Size = new System.Drawing.Size(136, 24);
            this.label13.TabIndex = 35;
            this.label13.Text = "Data directory";
            // 
            // textBoxPath
            // 
            this.textBoxPath.Location = new System.Drawing.Point(208, 14);
            this.textBoxPath.Name = "textBoxPath";
            this.textBoxPath.Size = new System.Drawing.Size(258, 20);
            this.textBoxPath.TabIndex = 34;
            this.textBoxPath.Tag = "32";
            // 
            // label12
            // 
            this.label12.Location = new System.Drawing.Point(16, 14);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(136, 24);
            this.label12.TabIndex = 33;
            this.label12.Text = "Save in path";
            // 
            // buttonOK
            // 
            this.buttonOK.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(212)))), ((int)(((byte)(208)))), ((int)(((byte)(200)))));
            this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.buttonOK.Font = new System.Drawing.Font("Verdana", 9F);
            this.buttonOK.Location = new System.Drawing.Point(264, 336);
            this.buttonOK.Name = "buttonOK";
            this.buttonOK.Size = new System.Drawing.Size(104, 40);
            this.buttonOK.TabIndex = 100;
            this.buttonOK.Text = "OK";
            this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
            // 
            // buttonCancel
            // 
            this.buttonCancel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(212)))), ((int)(((byte)(208)))), ((int)(((byte)(200)))));
            this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.buttonCancel.Font = new System.Drawing.Font("Verdana", 9F);
            this.buttonCancel.Location = new System.Drawing.Point(408, 336);
            this.buttonCancel.Name = "buttonCancel";
            this.buttonCancel.Size = new System.Drawing.Size(104, 40);
            this.buttonCancel.TabIndex = 200;
            this.buttonCancel.Text = "Cancel";
            this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
            // 
            // FormOptions
            // 
            this.AcceptButton = this.buttonOK;
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(760, 429);
            this.Controls.Add(this.buttonCancel);
            this.Controls.Add(this.buttonOK);
            this.Controls.Add(this.tabControl1);
            this.Menu = this.mainMenu1;
            this.Name = "FormOptions";
            this.Text = "Options";
            this.tabPageList.ResumeLayout(false);
            this.tabPageGrid.ResumeLayout(false);
            this.tabControl1.ResumeLayout(false);
            this.tabPageGeneral.ResumeLayout(false);
            this.gbxSimulation.ResumeLayout(false);
            this.gbxUserTradings.ResumeLayout(false);
            this.gbxChart.ResumeLayout(false);
            this.tabPageTrade.ResumeLayout(false);
            this.tabPageTrade.PerformLayout();
            this.tabPageStockGraph.ResumeLayout(false);
            this.tabPageUpdateQuotes.ResumeLayout(false);
            this.tabPagetabPageIntraday.ResumeLayout(false);
            this.tabPagetabPageIntraday.PerformLayout();
            this.tabPagePath.ResumeLayout(false);
            this.tabPagePath.PerformLayout();
            this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void buttonSave_Click(object sender, System.EventArgs e)
		{
			//gridDetails.SaveOptionsList();
	
		}
		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void buttonDefault_Click(object sender, System.EventArgs e)
		{
			//gridDetails.SetFullDefaultListView();
}
		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void buttonSimpleDefault_Click(object sender, System.EventArgs e)
		{
			//gridDetails.SetSimpleDefaultListView();

		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void buttonSimpleDefaultGrid_Click(object sender, System.EventArgs e)
		{
			dataGridClass.SimpleDefaultGrid();
		}
		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void buttonDefaultGrid_Click(object sender, System.EventArgs e)
		{
			dataGridClass.SetLargeDefaultView();
		}
		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void buttonSaveGrid_Click(object sender, System.EventArgs e)
		{
			dataGridClass.SaveOptionsGrid();
		}
		
		/// <summary>
		/// tabControl1_SelectedIndexChanged
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void tabControl1_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			try
			{
				TabControl locTabcontrol = (TabControl)sender;
				TabPage locTabPage = locTabcontrol.SelectedTab;
				if (locTabPage.Equals(this.tabPageGeneral))
				{
					this.ConfigurationDate();
				}
			}
			catch (Exception exc)
			{
				Debug.WriteLine("Error selecting TabPage: " + exc.Message);
			}
		}
		/// <summary>
		/// buttonDateDefault_Click
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void buttonDateDefault_Click(object sender, System.EventArgs e)
		{
			this.SetDefaultDates();
		}
		/// <summary>
		/// buttonDateSave_Click
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void buttonDateSave_Click(object sender, System.EventArgs e)
		{
	
			SaveAll();
			
		}
		private void SaveAll()
		{
			//this.programContext.ChangeEndDate(this.datePickerCharMax.Value.ToShortDateString());
			this.programContext.Configuration.Dates.DateMaxSimulation = this.dateTimePickerSimulationMax.Value;
			this.programContext.Configuration.Dates.DateMinSimulation = this.dateTimePickerSimulationMin.Value;//.ToShortDateString());
			if(this.programContext.Configuration.Dates.DateMaxSimulation < this.programContext.Configuration.Dates.DateMinSimulation)
				this.programContext.Configuration.Dates.DateMaxSimulation = this.programContext.Configuration.Dates.DateMinSimulation;

			this.programContext.Configuration.Dates.DateMaxUserTrade = this.datePickerTradeMax.Value;
			this.programContext.Configuration.Dates.DateMinUserTrade = this.datePickerTradeMin.Value;
			if(this.programContext.Configuration.Dates.DateMaxUserTrade < this.programContext.Configuration.Dates.DateMinUserTrade)
                this.programContext.Configuration.Dates.DateMaxUserTrade = this.programContext.Configuration.Dates.DateMinUserTrade;

			this.programContext.Configuration.Dates.DateMaxChart = this.datePickerCharMax.Value;
			//this.programContext.Configuration.Dates.DateMinChartSilent = this.datePickerChartMin.Value;
			this.programContext.Configuration.Dates.DateMinChart = this.datePickerChartMin.Value;

			if(this.programContext.Configuration.Dates.DateMaxChart < this.programContext.Configuration.Dates.DateMinChart)
				this.programContext.Configuration.Dates.DateMaxChart = this.programContext.Configuration.Dates.DateMinChart;

			this.programContext.Configuration.Dates.DateMaxChart = this.datePickerCharMax.Value;
			this.programContext.Configuration.Dates.DateMinChartSilent = this.datePickerChartMin.Value;
			if(this.programContext.Configuration.Dates.DateMaxChart < this.programContext.Configuration.Dates.DateMinChart)
				this.programContext.Configuration.Dates.DateMaxChart = this.programContext.Configuration.Dates.DateMinChart;


			//update chart - sets an event !!
			this.programContext.Configuration.Dates.DateMinChart = this.programContext.Configuration.Dates.DateMin;


			this.programContext.Configuration.Serialize();

			this.programContext.Configuration.TradeShortSellAllowed = this.checkBoxShortSell.Checked;
			this.programContext.Configuration.TradeShortSellOtherFile = this.checkBoxShortSellOtherSystem.Checked;
			this.programContext.Configuration.TradeStopLoss = this.checkBoxStopLoss.Checked;
			this.programContext.Configuration.TradeStopWin = this.checkBoxStopWin.Checked;
			this.programContext.Configuration.IntradayModus = this.checkBoxIntradayTrade.Checked;
			this.programContext.Configuration.FuturesTrade = this.checkBoxFuturesTrade.Checked;

			this.programContext.Configuration.TradeStopLossDynamic = this.checkBoxDynamicLimit.Checked;


            this.programContext.Configuration.WebUpdate_Only200 = this.checkBoxWebUpdateOnlyLast200.Checked;




			if(this.checkBoxTrade10000.Checked)
			{
				this.programContext.Configuration.TradeMoneyType = CUtil.TradeMoneyType.TradeWithAllMoney;
			}
            if (this.checkBoxTradeOneShare.Checked)
            {
                this.programContext.Configuration.TradeMoneyType = CUtil.TradeMoneyType.TradeOneShare;
            }
            else
			{
				this.programContext.Configuration.TradeMoneyType = CUtil.TradeMoneyType.TradeWith10000;
			}

			int i = this.programContext.Configuration.TradeStopLossPercentage;
			try
			{
				i = Convert.ToInt32(this.textBoxStopLoss.Text);
			}
			catch
			{
				//do othing
			}
			this.programContext.Configuration.TradeStopLossPercentage = i;

			try
			{
				i = Convert.ToInt32(this.textBoxStopWin.Text);
			}
			catch
			{
				//do nothing
			}
			this.programContext.Configuration.TradeStopWinPercentage = i;


			this.programContext.Configuration.Serialize();
			


			//Intraday 
			this.programContext.Configuration.Dates.DateIntraday = this.dateTimePickerIntraday.Value;

			i = 10;
			try
			{
				i = Convert.ToInt32(this.textBoxIntradaySaveInterval.Text);
			}	
			catch
			{
			}
			this.programContext.Configuration.IntradayDataSaveInterval = i;

			i = 0;
			try
			{
				i = Convert.ToInt32(this.textBoxDynamicLimit.Text);
			}
			catch
			{
				//do nothing
			}
			this.programContext.Configuration.TradeStopLossDynamicPercentage = i;
            string str1 = ProgramModes.Chart.ToString();

            GetProgramMode();

            this.programContext.Configuration.Dates.DateMinWebupdate = this.datePickerUpdateStart.Value;
            this.programContext.Configuration.Dates.DateMaxWebupdate = this.datePickerUpdateEnd.Value;


            ChangePath();
            this.programContext.Configuration.Serialize();

		}
        private void GetProgramMode()
        {
            switch (this.comboBoxProgramMode.SelectedIndex)
            {
                case 0:
                    {
                        this.programContext.Configuration.ProgramMode = ProgramModes.Chart;
                        break;
                    }
                case 1:
                    {
                        this.programContext.Configuration.ProgramMode = ProgramModes.Realtime;
                        break;
                    }
                case 2:
                    {
                        this.programContext.Configuration.ProgramMode = ProgramModes.Simulation;
                        break;
                    }
                case 3:
                    {
                        this.programContext.Configuration.ProgramMode = ProgramModes.UserTrade;
                        break;
                    }

            }

        }
        private void SetProgramMode()
        {
            switch (this.programContext.Configuration.ProgramMode)
            {
                case ProgramModes.Chart:
                    {
                        this.comboBoxProgramMode.SelectedIndex = 0;
                        break;
                    }
                case ProgramModes.Realtime:
                    {
                        this.comboBoxProgramMode.SelectedIndex = 1;
                        break;
                    }
                case ProgramModes.Simulation:
                    {
                        this.comboBoxProgramMode.SelectedIndex = 2;
                        break;
                    }
                case ProgramModes.UserTrade:
                    {
                        this.comboBoxProgramMode.SelectedIndex = 3;
                        break;
                    }

            }

        }

		/// <summary>
		/// ConfigurationDate
		/// </summary>
		private void ConfigurationDate()
		{
			try
			{
				this.datePickerChartMin.Text = this.programContext.Configuration.Dates.DateMinChart.ToShortDateString();
				this.datePickerCharMax.Text = this.programContext.Configuration.Dates.DateMaxChart.ToShortDateString();

				this.datePickerTradeMin.Text = this.programContext.Configuration.Dates.DateMinUserTrade.ToShortDateString();
				this.datePickerTradeMax.Text = this.programContext.Configuration.Dates.DateMaxUserTrade.ToShortDateString();

				this.dateTimePickerSimulationMin.Text = this.programContext.Configuration.Dates.DateMinSimulation.ToShortDateString();
				this.dateTimePickerSimulationMax.Text = this.programContext.Configuration.Dates.DateMaxSimulation.ToShortDateString();


			}
			catch (Exception exc)
			{
				Debug.Assert(false,"Error setting default configuration",exc.Message);
				Debug.WriteLine("Error loading Configuration: " + exc.Message);
			}
		}
		
		/// <summary>
		/// SetDefaultDates
		/// </summary>
		private void SetDefaultDates()
		{
			try
			{
				this.datePickerChartMin.Value = this.programContext.Configuration.Dates.DateMinReset;
				this.datePickerCharMax.Value = this.programContext.Configuration.Dates.DateMaxReset;
				this.datePickerTradeMin.Value = this.programContext.Configuration.Dates.DateMinReset;
				this.datePickerTradeMax.Value = this.programContext.Configuration.Dates.DateMaxReset;
				this.dateTimePickerSimulationMin.Value = this.programContext.Configuration.Dates.DateMinReset;
				this.dateTimePickerSimulationMax.Value = this.programContext.Configuration.Dates.DateMaxReset;

                this.datePickerUpdateStart.Value = this.programContext.Configuration.Dates.DateMinReset;
				//this.SaveAll();

			}
			catch (Exception exc)
			{
				Debug.WriteLine("Error setting default GraphDates: " + exc.Message);
			}
		}


		private void buttonOK_Click(object sender, System.EventArgs e)
		{
			
			SaveAll();
			this.Close();
		}

		private void buttonCancel_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

        //private void buttonDownloadUpdateFile_Click(object sender, System.EventArgs e)
        //{
        //    this.Cursor =  System.Windows.Forms.Cursors.WaitCursor;
        //    this.QuoteWriter.DownloadFile();
        //    this.Cursor =  System.Windows.Forms.Cursors.Default;
        //}
	
        //private void buttonExtractZipFile_Click(object sender, System.EventArgs e)
        //{
        //    this.Cursor =  System.Windows.Forms.Cursors.WaitCursor;
        //    this.QuoteWriter.ExtractZipFiles();
        //    this.Cursor =  System.Windows.Forms.Cursors.Default;
		
        //}

		private void buttonUpdate_Click(object sender, System.EventArgs e)
		{
			this.Cursor =  System.Windows.Forms.Cursors.WaitCursor;
			DateTime dateStart = new DateTime(1900,1,1);
			this.QuoteWriter.UpdateQuotes(datePickerUpdateEnd.Value);
			this.Cursor =  System.Windows.Forms.Cursors.Default;
		
		}
     

		private void buttonDefaultIntraday_Click(object sender, System.EventArgs e)
		{
		
			this.dateTimePickerIntraday.Value = this.programContext.Configuration.Dates.DateIntraday;
            textBoxIntradaySaveInterval.Text = "300";

		}

		private void buttonSaveIntraday_Click(object sender, System.EventArgs e)
		{
			this.programContext.Configuration.Dates.DateIntraday = this.dateTimePickerIntraday.Value;
		}

     
        private void ChangePath()
        {
            string myPathBin = this.textBoxPath.Text;
            string myPathData = this.textBoxDataDirectory.Text;
            string myID = this.textBoxID.Text;

            
           
            ProgramContext.Reg_SaveLastPath(myPathBin, myID);
        }
        private void SetPath()
        {
            string myPathBin = string.Empty;
            string myPathData = string.Empty;
            string myID = string.Empty;

            ProgramContext.Reg_GetLastPath(ref myPathBin, ref myID);
            this.textBoxPath.Text = myPathBin;
            this.textBoxDataDirectory.Text = myPathData;
            this.textBoxID.Text = myID;

         
        }

        private void checkBoxStopWin_CheckedChanged(object sender, EventArgs e)
        {
            labelStopWin.Enabled = checkBoxStopWin.Checked;
            textBoxStopWin.Enabled = checkBoxStopWin.Checked;
        }

        private void checkBoxStopLoss_CheckedChanged(object sender, EventArgs e)
        {
            labelStopLoss.Enabled = checkBoxStopLoss.Checked;
            textBoxStopLoss.Enabled = checkBoxStopLoss.Checked;
        }

        private void checkBoxDynamicLimit_CheckedChanged(object sender, EventArgs e)
        {
            labelDynamicLimit.Enabled = checkBoxDynamicLimit.Checked;
            textBoxDynamicLimit.Enabled = checkBoxDynamicLimit.Checked;
        }

        private void buttonBrowsePath_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dlg = new FolderBrowserDialog();
            dlg.RootFolder = Environment.SpecialFolder.MyComputer;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                textBoxPath.Text = dlg.SelectedPath;
            }
        }

        private void buttonBrowseDirectory_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dlg = new FolderBrowserDialog();
            dlg.RootFolder = Environment.SpecialFolder.MyComputer;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                textBoxDataDirectory.Text = dlg.SelectedPath;
            }
            dlg.Dispose();
        }

        private void buttonDownloadUpdateFile_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.MessageBox.Show("Functionlity currently under rework ");
        }

    

	
	

	

	

		
	

	}
}
